package com.iplant.wms.service.po.mfs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.DBJoinMulti;
import com.iplant.base.utils.annotation.po.DBBasePO;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


/**
 * 区域  将一个仓库分为几个区域  分区域管理
 *
 * @author Femi
 */
@DBBasePO(TableName = "wms_store_region", CheckName = {"Code", "StoreID,Name"}, Schemas = DBSchemas.WMS, CodeAuto = true, CodePrefix = "KQY-",Cache = true)
public class WMSStoreRegion extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;


    @DBCondition
    @DBField
    public int StoreID = 0;

    @DBCondition
    @DBJoin(name = "Code", tableName = "wms_store", tableAsName = "r1", Schemas = DBSchemas.WMS,
            MainTableField = "StoreID")
    public String StoreCode = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "wms_store", tableAsName = "r1", Schemas = DBSchemas.WMS,
            MainTableField = "StoreID")
    public String StoreName = "";

    /**
     * 关联工厂列表  后续生产配料 生产入库需要同工厂关联
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.findInSet)
    @DBJoin(name = "FactoryIDList", tableName = "wms_store", tableAsName = "r1", Schemas = DBSchemas.WMS,
            MainTableField = "StoreID")
    public List<Integer> FactoryIDList = new ArrayList<>();


    @DBJoinMulti(Name = "Code", TableName = "fmc_factory", MainTableField = "FactoryIDList", Schemas = DBSchemas.Basic)
    public String FactoryCode = "";

    @DBJoinMulti(Name = "Name", TableName = "fmc_factory", MainTableField = "FactoryIDList", Schemas = DBSchemas.Basic)
    public String FactoryName = "";


    @DBCondition
    @DBJoin(name = "TypeID", tableName = "wms_store", tableAsName = "r1", Schemas = DBSchemas.WMS,
            MainTableField = "StoreID")
    public int StoreTypeID = 0;

    /**
     * 定义仓库类型枚举
     */
    @DBJoin(name = "Name", tableName = "wms_store_type", tableAsName = "st1",JoinIndex = 3,
            Schemas = DBSchemas.WMS, ConditionalJoin = "r1.TypeID=st1.ID")

    public String StoreTypeName = "";


    @JsonProperty("FactoryIDList")
    public List<Integer> getFactoryIDList() {
        return FactoryIDList;
    }

    public void setFactoryIDList(List<Integer> factoryIDList) {
        FactoryIDList = factoryIDList;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    @JsonProperty("StoreTypeID")
    public int getStoreTypeID() {
        return StoreTypeID;
    }

    public void setStoreTypeID(int storeTypeID) {
        StoreTypeID = storeTypeID;
    }

    @JsonProperty("StoreTypeName")
    public String getStoreTypeName() {
        return StoreTypeName;
    }

    public void setStoreTypeName(String storeTypeName) {
        StoreTypeName = storeTypeName;
    }

    @JsonProperty("StoreID")
    public int getStoreID() {
        return StoreID;
    }

    public void setStoreID(int storeID) {
        StoreID = storeID;
    }

    @JsonProperty("StoreCode")
    public String getStoreCode() {
        return StoreCode;
    }

    public void setStoreCode(String storeCode) {
        StoreCode = storeCode;
    }

    @JsonProperty("StoreName")
    public String getStoreName() {
        return StoreName;
    }

    public void setStoreName(String storeName) {
        StoreName = storeName;
    }
}
